A member of the Barcode1DWriterType enumeration. The type of the required barcode.
The data to encode using the required barcode.
The horizontal (X) coordinate of the destination point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
The vertical (Y) coordinate of the destination point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
The width of the barcode's bounding box, expressed in the current units specified by the SetMeasurementUnit method.
The height of the barcode's bounding box, expressed in the current units specified by the SetMeasurementUnit method.
The amount of cyan color to be used for the barcode's resulting color. Use the value between 0 and 255.
The amount of magenta to be used for the barcode's resulting color. Use the value between 0 and 255.
The amount of yellow to be used for the barcode's resulting color. Use the value between 0 and 255.
The amount of black (key) color to be used for the barcode's resulting color. Use the value between 0 and 255.
Example





In This Topic
GdPicture.NET.14 (COM - ActiveX)~GdPicture14_namespace / GdPicture.NET.14 (COM - ActiveX)~GdPicture14.GdPicturePDF / DrawBarcode1D_2 Method

DrawBarcode1D_2 Method (GdPicturePDF)

In This Topic
Draws a required 1D barcode onto the currently selected page of the loaded PDF document according to your preference.

This method uses the CMYK color space for defining the barcode's desired color.

The coordinates and the dimensions of the specified barcode need to be set in the current units with respect to the currently located origin defined in the PDF document, related to the actual page, where the barcode is to be drawn. You can use the GdPicturePDF.GetMeasurementUnit method to determine the currently defined units and you can use the GdPicturePDF.SetMeasurementUnit method to reset the units according to your preference.

Syntax
'Declaration
 
Public Function DrawBarcode1D_2( _
   ByVal BarcodeType As Barcode1DWriterType, _
   ByVal Data As String, _
   ByVal DstX As Single, _
   ByVal DstY As Single, _
   ByVal DstWidth As Single, _
   ByVal DstHeight As Single, _
   ByVal Cyan As Byte, _
   ByVal Magenta As Byte, _
   ByVal Yellow As Byte, _
   ByVal Black As Byte _
) As GdPictureStatus
public GdPictureStatus DrawBarcode1D_2( 
   Barcode1DWriterType BarcodeType,
   string Data,
   float DstX,
   float DstY,
   float DstWidth,
   float DstHeight,
   byte Cyan,
   byte Magenta,
   byte Yellow,
   byte Black
)
public function DrawBarcode1D_2( 
    BarcodeType: Barcode1DWriterType;
    Data: String;
    DstX: Single;
    DstY: Single;
    DstWidth: Single;
    DstHeight: Single;
    Cyan: Byte;
    Magenta: Byte;
    Yellow: Byte;
    Black: Byte
): GdPictureStatus; 
public function DrawBarcode1D_2( 
   BarcodeType : Barcode1DWriterType,
   Data : String,
   DstX : float,
   DstY : float,
   DstWidth : float,
   DstHeight : float,
   Cyan : byte,
   Magenta : byte,
   Yellow : byte,
   Black : byte
) : GdPictureStatus;
public: GdPictureStatus DrawBarcode1D_2( 
   Barcode1DWriterType BarcodeType,
   string* Data,
   float DstX,
   float DstY,
   float DstWidth,
   float DstHeight,
   byte Cyan,
   byte Magenta,
   byte Yellow,
   byte Black
) 
public:
GdPictureStatus DrawBarcode1D_2( 
   Barcode1DWriterType BarcodeType,
   String^ Data,
   float DstX,
   float DstY,
   float DstWidth,
   float DstHeight,
   byte Cyan,
   byte Magenta,
   byte Yellow,
   byte Black
) 

Parameters

BarcodeType
A member of the Barcode1DWriterType enumeration. The type of the required barcode.
Data
The data to encode using the required barcode.
DstX
The horizontal (X) coordinate of the destination point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
DstY
The vertical (Y) coordinate of the destination point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
DstWidth
The width of the barcode's bounding box, expressed in the current units specified by the SetMeasurementUnit method.
DstHeight
The height of the barcode's bounding box, expressed in the current units specified by the SetMeasurementUnit method.
Cyan
The amount of cyan color to be used for the barcode's resulting color. Use the value between 0 and 255.
Magenta
The amount of magenta to be used for the barcode's resulting color. Use the value between 0 and 255.
Yellow
The amount of yellow to be used for the barcode's resulting color. Use the value between 0 and 255.
Black
The amount of black (key) color to be used for the barcode's resulting color. Use the value between 0 and 255.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.
Example
How to draw a 1-dimensional barcode on the newly created page of the new PDF document.
Dim caption As String = "Example: DrawBarcode1D_2"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
    status = gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeLetter)
    If status = GdPictureStatus.OK Then
        If (gdpicturePDF.DrawBarcode1D_2(Barcode1DWriterType.Barcode1DWriterCode128, "0123456789", 2, 2, 15, 10, 0, 255, 0, 0) = GdPictureStatus.OK) AndAlso
           (gdpicturePDF.DrawBarcode1D_2(Barcode1DWriterType.Barcode1DWriterCode128, "9876543210", 2, 16, 15, 10, 0, 255, 0, 0) = GdPictureStatus.OK) Then
            status = gdpicturePDF.SaveToFile("test_DrawBarcode1D.pdf")
            If status = GdPictureStatus.OK Then
                MessageBox.Show("The example has been followed successfully and the file has been saved.", caption)
            Else
                MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("The one of the DrawBarcode1D_2() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
        End If
    Else
        MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), caption)
    End If
Else
    MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: DrawBarcode1D_2";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
    status = gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeLetter);
    if (status == GdPictureStatus.OK)
    {
       if ((gdpicturePDF.DrawBarcode1D_2(Barcode1DWriterType.Barcode1DWriterCode128, "0123456789", 2, 2, 15, 10, 0, 255, 0, 0) == GdPictureStatus.OK) &&
           (gdpicturePDF.DrawBarcode1D_2(Barcode1DWriterType.Barcode1DWriterCode128, "9876543210", 2, 16, 15, 10, 0, 255, 0, 0) == GdPictureStatus.OK))
        {
            status = gdpicturePDF.SaveToFile("test_DrawBarcode1D.pdf");
            if (status == GdPictureStatus.OK)
                MessageBox.Show("The example has been followed successfully and the file has been saved.", caption);
            else
                MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption);
        }
        else
            MessageBox.Show("The one of the DrawBarcode1D_2() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
    }
    else
        MessageBox.Show("The NewPage() method has failed with the status: " + status.ToString(), caption);
}
else
    MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption);
gdpicturePDF.Dispose();
See Also